﻿using BridgePattern.Bridge;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BridgePattern
{
    /// <summary>
    /// 1 多重继承与变化封装
    /// 2 桥接模式：解决多维度的变化
    /// </summary>
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                Console.WriteLine("欢迎来到.net高级班公开课之设计模式特训，今天是Eleven老师为大家带来的桥接模式BridgePattern");
                {
                    Console.WriteLine("*****************************************");
                    BasePhone phone = new iPhone();
                    phone.Call();
                    phone.Text();
                }
                {
                    Console.WriteLine("*****************************************");
                    BasePhone phone = new Lumia();
                    phone.Call();
                    phone.Text();
                }
                {
                    Console.WriteLine("*****************************************");
                    BasePhone phone = new Mi();
                    phone.Call();
                    phone.Text();
                }
                {
                    Console.WriteLine("*****************************************");
                    BasePhone phone = new iPhoneAndroid();
                    phone.Call();
                    phone.Text();
                }
                Console.WriteLine("********************************************************");
                Console.WriteLine("********************************************************");
                Console.WriteLine("********************************************************");

                {
                    Console.WriteLine("*****************************************");
                    ISystem system = new SystemAndroid();
                    BasePhoneBridge phone = new iPhoneBridge(system);
                    phone.Call();
                    phone.Text();
                }
                {
                    Console.WriteLine("*****************************************");
                    ISystem system = new SystemIOS();
                    BasePhoneBridge phone = new iPhoneBridge(system);
                    phone.Call();
                    phone.Text();
                }
                {
                    Console.WriteLine("*****************************************");
                    ISystem system = new SystemWinPhone();
                    BasePhoneBridge phone = new iPhoneBridge(system);
                    phone.Call();
                    phone.Text();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            Console.Read();
        }
    }
}
